/**
 * 文件功能描述: 项目通用启动入口
 * 导出一个工厂函数，用于创建新的
 * 应用程序、router 和 store 等实例
 */

import Vue from 'vue';
import App from '@/App.vue'
import { createRouter } from '@/router/index.js'
import { createStore } from '@/store/index.js'
import { sync } from 'vuex-router-sync'

export function createApp(cookies) {
  const router = createRouter(cookies)
  const store = createStore()

  sync(store, router, { moduleName: 'route' } )

  const app = new Vue({
    router,
    store,
    render: h => h(App)
  })
  return { app, router, store }
}
